package cz.muni.fi.pb138.eis_core;

import javax.xml.xquery.XQException;
import javax.xml.xquery.XQResultSequence;

/**
 * This interface describes a convenience class
 * encapsulating an XQConnection
 * used for querying the XML database.
 * Execute method is reusable.
 * Do not forget to call close() method when done!!!
 * 
 * @author Jakub Senko
 */
public interface Query
{
    /**
     *   Executes given command.
     * 
     * @param s    Command to be executed
     * @return     Result of evaluation XQuery expression
     * @throws XQException An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
     */
    public XQResultSequence execute(String s) throws XQException;
    
    /**
     *  This method needs to be called after work with querys is finished.
     * 
     * @throws XQException An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
     */
    public void close() throws XQException;
}
